package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.NameValueData;
import com.itheima.pojo.JobOption;
import com.itheima.service.EmpService;
import com.itheima.service.StudentService;
import com.itheima.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*统计*/
@RestController
@RequestMapping("/report")
public class JobOptionController {


    @Autowired
    EmpService empService;

    @Autowired
    StudentService studentService;

    /**
     * 统计每个职位的员工人数
     *
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        JobOption jobOption = empService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 根据性别统计员工人数
     *
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<NameValueData> genderDataList = empService.getEmpGenderData();
        return Result.success(genderDataList);
    }

    /**
     * 班级人数统计
     *
     * @return
     */
    @GetMapping("/studentCountData")
    public Result getStudentsByClazz() {
        ClazzOption clazzOption = studentService.getStudentsByClazz();
        return Result.success(clazzOption);
    }

    /**
     * 学员学历统计
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData() {
        List<NameValueData> list = studentService.studentDegreeData();
        return Result.success(list);
    }
}
